/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/

#include <qsqldatabase.h>
#include <qdatatable.h>
#include <qsqlcursor.h>
#include <qmessagebox.h>
#include <qsqlselectcursor.h>
#include "wspolnota_form.h"

QSqlDatabase * db;

void Form1::init()
{
    db = QSqlDatabase::addDatabase( "QPSQL7" );    
    db->setDatabaseName( "wspolnota" );
    db->setHostName( "/var/run/postgresql" );
    
}



void Form1::loguj()
{
db->setUserName( leUser->text() );
db->setPassword( lePassword->text() );
if (db->open())
{
wspolnotaForm();
close();
} else
{
QMessageBox::information( this, "ERROR", "Bledny login lub haslo");    
}
}


void Form1::wspolnotaForm()
{
Form2 *wspolnota_form= new Form2;
  wspolnota_form->show();

}
